package com.our.biz;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.our.dao.RepResourceMapper;
import com.our.model.RepResource;
import com.our.util.BusinessException;
@Service
public class RepResourceBiz {
	
	@Resource
	private RepResourceMapper dao;
	
	public List<RepResource> findAll() throws BusinessException{
		try {
			return dao.selectAll();		
		} catch (Exception e) {
			throw new BusinessException("E0301B05");
		}
	}
	
	public RepResource findById(String resId) throws BusinessException{
		try {
			return dao.selectByPrimaryKey(resId);			
		} catch (Exception e) {
			throw new BusinessException("E0301B04");
		}
	}
	
	public void save(RepResource res) throws BusinessException{
			try{
				 dao.insert(res);
			}catch(Exception e){
				throw new BusinessException("E0301B01");
			}
		
	}
	
	public void delete(String resId) throws BusinessException{
		try {
			dao.deleteByPrimaryKey(resId);
		} catch (Exception e) {
			throw new BusinessException("E0301B02");
		}
	}
	
	public void update(RepResource res) throws BusinessException{
		try {
			dao.updateByPrimaryKey(res);
		} catch (Exception e) {
			throw new BusinessException("E0301B03");
		}
		
	}

}
